﻿using System;
using System.Collections.Generic;
using System.Text;
using Scripting;

namespace UserScripts
{
    class GlobalInteraction : ScriptBase
    {
        static void Main()
        {
        }
        public void SetSingleGlobal(Actor actor, string global, int value)
        {
            PacketWriter writer = new PacketWriter();
            writer.Write(value);
            actor.Globals[global] = writer.ToArray();
        }
        public void SetSingleGlobal(Actor actor, string global, string value)
        {
            PacketWriter writer = new PacketWriter();
            writer.Write(value, true);
            actor.Globals[global] = writer.ToArray();
        }
        public int GetSingleIntGlobal(Actor actor, string global)
        {
            PacketReader reader = new PacketReader(actor.Globals[global]);
            int result = reader.ReadInt32();
            return result;
        }
        public string GetSingleStringGlobal(Actor actor, string global)
        {
            PacketReader reader = new PacketReader(actor.Globals[global]);
            string result = reader.ReadString();
            return result;
        }
    }
}
